package cn.iocoder.yudao.module.fengdong.smartelderly.dal.mysql.dayconfig;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fengdong.smartelderly.dal.dataobject.dayconfig.DayconfigDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fengdong.smartelderly.controller.admin.dayconfig.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 月缴费配置 Mapper
 *
 * @author 沣东养老院管理员
 */
@Mapper
public interface DayconfigMapper extends BaseMapperX<DayconfigDO> {

    default PageResult<DayconfigDO> selectPage(DayconfigPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DayconfigDO>()
                .eqIfPresent(DayconfigDO::getAccount, reqVO.getAccount())
                .betweenIfPresent(DayconfigDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DayconfigDO::getTitle, reqVO.getTitle())
                .eqIfPresent(DayconfigDO::getDay, reqVO.getDay())
                .eqIfPresent(DayconfigDO::getContent, reqVO.getContent())
                .eqIfPresent(DayconfigDO::getMoney, reqVO.getMoney())
                .eqIfPresent(DayconfigDO::getTimingDay, reqVO.getTimingDay())
                .eqIfPresent(DayconfigDO::getType, reqVO.getType())
                .eqIfPresent(DayconfigDO::getStatus, reqVO.getStatus())
                .orderByDesc(DayconfigDO::getId));
    }

    default List<DayconfigDO> selectList(DayconfigExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<DayconfigDO>()
                .eqIfPresent(DayconfigDO::getAccount, reqVO.getAccount())
                .betweenIfPresent(DayconfigDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(DayconfigDO::getTitle, reqVO.getTitle())
                .eqIfPresent(DayconfigDO::getDay, reqVO.getDay())
                .eqIfPresent(DayconfigDO::getContent, reqVO.getContent())
                .eqIfPresent(DayconfigDO::getMoney, reqVO.getMoney())
                .eqIfPresent(DayconfigDO::getTimingDay, reqVO.getTimingDay())
                .eqIfPresent(DayconfigDO::getType, reqVO.getType())
                .eqIfPresent(DayconfigDO::getStatus, reqVO.getStatus())
                .orderByDesc(DayconfigDO::getId));
    }

    default Long selectTenantIdOne(DayconfigCreateReqVO reqVO) {
        return selectCount(new LambdaQueryWrapperX<DayconfigDO>()
                .eqIfPresent(DayconfigDO::getType, reqVO.getType()));
    }

    List<DayconfigByTenantId> selectDayconfigList();
}
